#include <stdio.h>
#include "device_manager.h"

int sd_read(void)
{
    printf("sd read data...\n");
    return 10;
}
int udisk_read(void)
{
    printf("udisk read data...\n");
    return 20;
}

struct storage_device sd = {"sdcard",sd_read};
struct storage_device udisk = {"udisk",udisk_read};

int main(void) 
{
    register_device(sd);            //高层模块函数注册，以便回调
    register_device(udisk);

    read_device((char*)"udisk");    //实现回调，控制反转
    read_device((char*)"udisk");
    read_device((char*)"uk");
    read_device((char*)"sdcard");
    read_device((char*)"sdcard");

    return 0;
}
